package jin.si.com.web;

import jin.si.com.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 测试Thymeleaf
 * @ClassName TestThymeleafController
 * @Author MT
 * @Date 2021/5/13 10:17
 **/

@Controller
@RequestMapping("/thy")
public class TestThymeleafController {



    @RequestMapping("/getThymeleaf")
    public String getThymeleaf(ModelMap modelMap){
        modelMap.addAttribute("name","臭宝宝");
        User u=new User();
        u.setName("大橙子");
        modelMap.addAttribute("user",u);


        List<User> list=new ArrayList<>();
        User u1=new User();
        u1.setName("猪肉");
        User u2=new User();
        u2.setName("粉条");
        User u3=new User();
        u3.setName("馒头");
        list.add(u1);
        list.add(u2);
        list.add(u3);
        modelMap.addAttribute("list",list);

        modelMap.addAttribute("flag","off");


        return "/thymeleaf/thy";
    }




}
